home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / vol_400 / 414_02 / private / _scb.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-06-17  |  2.3 KB  |  99 lines

  1. #define    CURSES_LIBRARY    1
  2. #define NEEDS_OS2       1
  3. #include <curses.h>
  4.  
  5. #ifdef PDCDEBUG
  6. char *rcsid__scb = "$Header: C:\CURSES\private\RCS\_scb.c 2.1 1993/06/18 20:23:37 MH Rel MH $";
  7. #endif
  8.  
  9. #ifdef OS2
  10. #  if defined (CURSES__32BIT__) || defined(CSET2) || defined(TC)
  11. #     include <signal.h>
  12. #  else
  13. #     define INCL_DOSSIGNALS
  14. #     define INCL_NOCOMMON
  15. #     include <bsedos.h>
  16. #  endif
  17. #endif
  18.  
  19.  
  20.  
  21. /*man-start*********************************************************************
  22.  
  23.   PDC_set_ctrl_break()    - Enables/Disables the host OS BREAK key check.
  24.  
  25.   PDCurses Description:
  26.      This is a private PDCurses routine.
  27.  
  28.      Enables/Disables the host OS BREAK key check. This function toggles
  29.      the BREAK setting. If it was on, it turns itoff; if it was aff it turns
  30.      it on.
  31.  
  32.   PDCurses Return Value:
  33.      This function returns OK on success and ERR on error.
  34.  
  35.   PDCurses Errors:
  36.      No errors are defined for this function.
  37.  
  38.   Portability:
  39.      PDCurses    int PDC_set_ctrl_break( bool setting );
  40.  
  41. **man-end**********************************************************************/
  42.  
  43. int    PDC_set_ctrl_break(bool setting)
  44. {
  45. #ifdef PDCDEBUG
  46.     if (trace_on) PDC_debug("PDC_set_ctrl_break() - called\n");
  47. #endif
  48.  
  49. #ifdef    FLEXOS
  50.     retcode = s_get(T_VIRCON, 0L, (char *) &vir, (long) sizeof(vir));
  51.     if (retcode < 0L)
  52.         return( ERR );
  53.  
  54.     vir.vc_kbmode = ((vir.vc_kbmode & ~0x01) & (setting) ? 0x01 : 0x00);
  55.  
  56.     retcode = s_set(T_VIRCON, 0L, (char *) &vir, (long) sizeof(vir));
  57.     return( (retcode < 0L) ? ERR : OK );
  58. #endif
  59.  
  60. #ifdef    DOS
  61.     regs.h.ah = 0x33;
  62.     regs.h.al = 0x00;
  63.     regs.h.dl = (unsigned char) (setting ? 1 : 0);
  64.     int86(0x21, ®s, ®s);
  65.     return( OK );
  66. #endif
  67.  
  68. #ifdef    OS2
  69. #  if defined (CURSES__32BIT__) || defined (CSET2) || defined(TC)
  70.     if (setting) {
  71.         signal (SIGINT, SIG_DFL);
  72.         signal (SIGBREAK, SIG_DFL);
  73.     } else {
  74.         signal (SIGINT, SIG_IGN);
  75.         signal (SIGBREAK, SIG_IGN);
  76.         }
  77.     return( OK );
  78. #  else
  79.     PFNSIGHANDLER oldHandler;
  80.     USHORT oldAction, Action;
  81.  
  82.     /* turn off control C checking */
  83.     if (setting)
  84.         Action = SIGA_KILL;
  85.     else
  86.         Action = SIGA_IGNORE;
  87.     DosSetSigHandler((PFNSIGHANDLER) NULL, &oldHandler, &oldAction,
  88.         Action, SIG_CTRLBREAK);
  89.     DosSetSigHandler((PFNSIGHANDLER) NULL, &oldHandler, &oldAction,
  90.         Action, SIG_CTRLC);
  91.     return( OK );
  92. #  endif    
  93. #endif
  94.  
  95. #ifdef UNIX
  96. /* INCOMPLETE */
  97. #endif
  98. }
  99.